import createVuePlugin from '@vitejs/plugin-vue2';
// 引入插件
import createAutoImport from './auto-import';
import createComponents from './components';
import createWindicss from './windicss';
import createLegacy from './legacy';
import createHtmlPlugin from './html-plugin';
import createCompression from './compression';
import createVisualizer from './visualizer';
import createSvgIcon from './svg-icon';
import path from 'path';

export default (viteEnv) => {
  const vitePlugins = [];
  vitePlugins.push(createVuePlugin());
  vitePlugins.push(createAutoImport());
  vitePlugins.push(createComponents());
  vitePlugins.push(createWindicss());
  vitePlugins.push(createLegacy());
  vitePlugins.push(createHtmlPlugin(viteEnv));
  vitePlugins.push(createCompression());
  vitePlugins.push(createVisualizer());
  vitePlugins.push(createSvgIcon(path));
  return vitePlugins;
};
